package com.shujia.wyh.day25;

public class MySleepThread extends Thread{
    @Override
    public void run() {
        for (int i = 1; i <= 300; i++) {
            System.out.println(getName() + ":" + i);
            //需求：每打印一次，间隔100毫秒再打印下一个
            //public static void sleep(long millis) throws InterruptedException
            //使当前正在执行的线程以指定的毫秒数暂停（暂时停止执行)
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
